Redis

What is Redis?

Redis (Remote Dictionary Server) is an in-memory data structure store, used as a distributed, in-memory key-value database, cache and message broker, with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices. Redis is open-source software released under a BSD 3-clause license although commercially supported paid versions are also available for enterprise users; Redis, Inc. commercially supports Redis Enterprise, which is available as an on-premises software deployment and a fully managed cloud service.

Redis’ popularity is owed to its ability to support high performance, low-latency caching at scale, making it particularly well-suited to cloud, large datacenter and microservices use cases. Redis enables faster application interactions such as quick data retrieval and a balanced load of backend services with caching.

Common use cases for Redis include:

  • Database
  • Caching
  • Chat, messaging, and queues
  • Session store
  • Geospatial indexes

What are the key features and characteristics of Redis?

Redis’ simplicity, performance, and rich feature set make it a popular choice for developers looking for a fast and versatile in-memory data store. Key features and characteristics include:

  • In-Memory Data Storage: Redis stores data primarily in memory, which allows for fast data access and retrieval. It can also persist data to disk for durability and recovery purposes.
  • Data Structures: Redis provides a set of data structures such as strings, lists, sets, sorted sets, hashes, bitmaps, and hyperloglogs. These data structures offer rich functionality and enable efficient operations and manipulations.
  • Performance: Redis is known for its exceptional performance. It achieves high throughput and low latency by keeping the data in memory and employing optimized data access and storage algorithms.
  • Pub/Sub Messaging: Redis supports Publish/Subscribe messaging, allowing multiple clients to publish messages to channels and subscribe to receive messages from specific channels. It provides a lightweight messaging system for building real-time applications or implementing message queues.
  • Caching: Redis is commonly used as a caching layer to store frequently accessed or computationally expensive data in memory. By caching data in Redis, applications can retrieve data more quickly, reducing the load on the primary data source.
  • Persistence: Redis offers different persistence options. It can write data asynchronously to disk (RDB persistence) or append data to a log-like file (AOF persistence). These persistence mechanisms ensure data durability and allow for recovery in case of system failures.
  • Replication and High Availability: Redis supports replication, allowing data to be replicated to multiple Redis instances. This provides redundancy and high availability in case of node failures. Redis also offers automatic failover and master-slave replication mechanisms.
  • Lua Scripting: Redis supports Lua scripting, allowing users to define and execute custom server-side logic. This feature enables complex operations and provides flexibility in implementing custom data processing or business logic.
  • Cluster Support: Redis Cluster allows for distributed data storage and automatic sharding of data across multiple Redis instances. It provides horizontal scalability and fault tolerance for large-scale deployments.

Is Redis a database or a cache?

Redis began as a caching database, but it has since evolved into a primary database. Many applications built today use Redis as a primary database. However, most Redis service providers support Redis as a cache but not as a primary database.

With Redis Enterprise, you can use Redis as both an in-memory cache and a primary database in a single system, thus eliminating the complexity and latency of two separate systems. Not only that, you can use it as a multi-model primary database, enabling you to build modern applications, as well as low-latency microservice-based architectures, all on top of Redis.


Is Redis relational or NoSQL?

Redis is an open source, in-memory key-value data structure store, which can be used as a database, cache, or message broker. It's a NoSQL database.


What alternatives to Redis are available?

There are many products whose characteristics and feature set overlap with those of Redis to some extent. Depending on the use case, alternatives that may provide comparable functionality or offer an alternative to Redis, include: Memcached, Apache Kafka, Apache Cassandra, Amazon ElastiCache, Hazelcast, Aerospike and Couchbase.


What is Microsoft Azure Cache for Redis?

Microsoft Azure Cache for Redis is a fully managed caching service provided by Microsoft Azure. It is built on the open-source Redis in-memory data store and offers a highly scalable and reliable caching solution in the cloud. Azure Cache for Redis allows applications to offload frequently accessed data from slower data stores or databases and store it in memory for faster retrieval, reducing latency and improving overall application performance.


What programming languages and frameworks support Redis integration?

You can use Redis from most programming languages. A comprehensive list of options is available on the Redis website, see: Get started using Redis clients | Redis. Popular choices include: Python, Java, Node.js, C#, PHP, Ruby, Go, JavaScript and Rust.

Redis is written in ANSI C and works on most POSIX systems like Linux, *BSD, and Mac OS X, without external dependencies. Linux and OS X are the two operating systems where Redis is developed and tested the most, and Redis’ recommends using Linux for deployment. Redis may work in Solaris-derived systems like SmartOS, but support is “best effort”. There is no official support for Windows builds.


What are the key metrics you should monitor for Redis?

Monitoring certain key Redis metrics will help ensure optimal performance, identify potential issues, and maintain the health and stability of your Redis deployment. Key metrics that you will probably want to monitor for Redis , include:

  • Memory Usage
  • CPU Utilization
  • Network Throughput
  • Latency
  • Commands Processed per Second
  • Cache Hit Ratio
  • Replication Lag
  • Persistence Status
  • Connections
  • Evicted Keys
  • Keyspace Hits and Misses
  • Blocked Clients
  • Cluster Health
  • Redis Cluster Rebalance
  • Command Error Rate

How do I monitor a Redis server?

Third-party platforms such as eG Enterprise simplify the monitoring of Redis Servers. Redis does provide some functionality to access performance data and metrics directly. MONITOR is a debugging command that streams back every command processed by the Redis server. It can help in understanding what is happening to the database. This command can both be used via redis-cli and via telnet. See: MONITOR | Redis.

For more information on how eG Enterprise can provide out-of-the-box monitoring, alerting, root-cause diagnostics, dashboards, reports and capacity planning for Redis and its dependencies, see: Redis Performance Monitoring Tools | eG Innovations.